package mypractice;

public class Work4 {
    public static void main(String[] args) {
        int[][] myArry={
            {30, 66, 48},   // 第一行
            {10, 33, 20},   // 第二行
            {10, 99, 103} ,// 第三行
            {9, 18, 27}//第四行
        };
        quarterAverage(myArry);
        yearSum(myArry);
    }

    public static void quarterAverage(int[][] myArry){
        int rows=myArry.length;
        int columns=myArry[0].length;
        int i,j;
        int sum=0,average=0;
        for(i=0;i<rows;i++){
            for(j=0;j<columns;j++){
                sum+=myArry[i][j];
            }
            average=sum/3;
            System.out.print(average+"  ");
        }
    }

    public static void yearSum(int[][] myArry){
        int rows=myArry.length;
        int columns=myArry[0].length;
        int i,j;
        int sum=0,average=0;
        for(i=0;i<rows;i++){
            for(j=0;j<columns;j++){
                sum+=myArry[i][j];
            }
        }
        System.out.print(sum);
    }
}
